<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
<link rel="stylesheet" href="__PUBLIC__/dist/css/bootstrap.min.css" rel="stylesheet"/>
    <!------chosen css+js-->
    <link href="__PUBLIC__/yksui/lib/chosen/chosen.css?20161227" rel="stylesheet" />

<!------timedate css+js-->
</head>
<body>
<div>
    <form style="margin:20px 30px;" id="transForm" method="post" action="{:U('Transportplan/ajaxEditTrans')}" onSubmit="return formCheck();">
        <input type="hidden" name="id" value="{$transDetail['id']}"/>
        <table class="table table-bordered">
            <tr>
                <td width="30%">物流计划单号</td>
                <td><input  class="form-control"  type="text" name="transport_plan_code" value="{$transDetail['transport_plan_code']}"
                            disabled/></td>
            </tr>
            <tr>
                <td width="30%">合同号</td>
                <td><input  class="form-control"  type="text" name="contract_no" value="{$transDetail['contract_no']}"
                           disabled/></td>
            </tr>
            <tr>
                <td width="30%">发票号</td>
                <td><input  class="form-control"  type="text" name="invoice_code" value="{$transDetail['invoice_code']}"
                            disabled/></td>
            </tr>
            <tr>
                <td>物流状态</td>
                <td>
                    <select class=" form-control" name="status" id="status" onchange="statuscheck(this.value)">
                        <!-- <button style="width:60px;" name="markship" type="button"
                                class="btn btn-xs btn-info" value="{$vo.id}">标记发货
                        </button> -->
                        <if condition="$transDetail['status'] eq '50'">
                            <option value="50"
                            <?php if ($transDetail['status']=="50"){ echo "selected";} ?>>待发货</option>
                        <else/>
                        </if>
                        <if condition="$transDetail['status'] eq '60'">
                            <option value="60"
                            <?php if ($transDetail['status']=="60"){ echo "selected";} ?>>已发货</option>
                        <else/>
                        </if>
                        <if condition="$transDetail['status'] eq '60' or $transDetail['status'] eq '70'">
                            <option value="70"
                            <?php if ($transDetail['status']=="70"){ echo "selected";} ?>>已到货</option>
                        <else/>
                        </if>
                        <if condition="$transDetail['status'] eq '100'">
                            <option value="100"
                            <?php if ($transDetail['status']=="100"){ echo "selected";} ?>>已取消</option>
                        <else/>
                        </if>
                    </select>
                </td>
            </tr>
            <!--<tr>
                <td>物流追踪码<font color="red">*</font> </td>
                <td><input class=" form-control"  type="text" name="certificate_code" value="{$transDetail['certificate_code']}" required></td>
            </tr>-->
            <tr>
                <td>承运商服务<font color="red">*</font></td>
                <td>
                    <select class=" chosen-select form-control" tabindex="-1"
                            data-name-group="common" name='carrier_service_id' id='carrier_service_id' required>
                        <option value=""
                        <!--<?php if($transDetail['carrier_service_id']==''){ echo ' selected';}?>>&#45;&#45; 请选择 &#45;&#45;</option>-->
                        <volist name='carrier_service' id='vo'>
                            <option value="{$key}"
                            <?php if($transDetail['carrier_service_id']==$key){ echo ' selected';}?>
                            >{$vo}</option>
                        </volist>
                    </select>
                </td>
            </tr>
            <tr>

                <td>目的国<font color="red">*</font></td>
                <td>
                    <select class="chosen-select form-control" tabindex="-1" name="destination_site_id"
                            data-name-group="common" id='sitelist' required>
                        <option value="" class="empty-opt">-- 请选择 --</option>
                        <volist name="sitelist" id="sl">
                            <option value="{$key}"
                            <?php if(isset($transDetail['destination_site_id'])&&$transDetail['destination_site_id']==$key){ echo ' selected';}?>>{$sl}</option>
                        </volist>
                    </select>
                </td>
            </tr>
            <tr>
                <td>清关口岸<font color="red">*</font></td>
                <td><input  type="text" class="form-control" name="clearance_port" value="{$transDetail['clearance_port']}" required></td>
            </tr>
            <tr>
                <td>目的国派送代理<font color="red">*</font></td>
                <td><input  type="text" class="form-control" name="delivery_proxy" value="{$transDetail['delivery_proxy']}" required></td>
            </tr>
            <tr>
                <td>司机姓名<font color="red">*</font></td>
                <td><input type="text" class="form-control" name="ori_driver_name" value="{$transDetail['ori_driver_name']}" required></td>
            </tr>
            <tr>
                <td>司机电话<font color="red">*</font></td>
                <td><input type="text" class="form-control" name="ori_driver_tel" value="{$transDetail['ori_driver_tel']}" required></td>
            </tr>
            <tr>
                <td>车牌号<font color="red">*</font></td>
                <td><input type="text" class="form-control" name="ori_license_plate_num" value="{$transDetail['ori_license_plate_num']}" required></td>
            </tr>
            <tr>
                <td>提单号/快递单号</td>
                <td><input type="text" class="form-control" name="ori_tracking_num" value="{$transDetail['ori_tracking_num']}" ></td>
            </tr>
            <tr>
                <td>入仓号/柜号</td>
                <td><input type="text" class="form-control" name="certificate_code" value="{$transDetail['certificate_code']}"/></td>
            </tr>
            <tr>
                <td>封条号</td>
                <td><input type="text" class="form-control" name="ori_seal_num" value="{$transDetail['ori_seal_num']}"/></td>
            </tr>
            <tr>
                <td>预计提货时间</td>
                <td><input type="text" class="form-control   layer-date" onClick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                           name="expected_pickup_time"
                           value="<?php if ($transDetail['expected_pickup_time']>0) {echo $transDetail['expected_pickup_time'];}?>"/></td>
            </tr>
            <tr>
                <td>到港时间</td>
                <td><input type="text" class="form-control  layer-date" onClick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                           name="arrive_port_date"
                           value="<?php if ($transDetail['arrive_port_date']>0) {echo $transDetail['arrive_port_date'];}?>"/></td>
            </tr>
            <tr>
                <td>起飞时间</td>
                <td><input type="text"  class="form-control  layer-date" onClick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                           name="take_off_date"
                           value="<?php if ($transDetail['take_off_date']>0) {echo $transDetail['take_off_date'];}?>"/></td>
            </tr>
            <tr>
                <td>到目的地时间</td>
                <td><input type="text"  class="form-control  layer-date" onClick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                           name="arrive_time" value="<?php if ($transDetail['arrive_time']>0) {echo $transDetail['arrive_time'];}?>"/>
                </td>
            </tr>
            <tr>
                <td>清关时间</td>
                <td><input type="text"  class="form-control  layer-date" onClick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                           name="customs_clearance_date"
                           value="<?php if ($transDetail['customs_clearance_date']>0) {echo $transDetail['customs_clearance_date'];}?>"/></td>
            </tr>
            <tr>
                <td>派送时间</td>
                <td><input type="text"  class="form-control  layer-date" onClick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})"
                           name="delivery_date"
                           value="<?php if ($transDetail['delivery_date']>0) {echo $transDetail['delivery_date'];}?>"/></td>
            </tr>
        </table>
        <input class="btn" style="margin-left:48%;padding:8px 30px;background:#3280fc;color:#fff;" type="submit" id="sub" name="sub" value="确定"/>
        <!--<div id="sub" class="btn" style="margin-left:48%;padding:8px 30px;background:#3280fc;color:#fff;"><b>确定</b></div>-->
        <input type="hidden" name="transport_plan_code" id="transport_plan_code"
               value="{$transDetail['transport_plan_code']}"/>
    </form>
</div>
<script type="text/javascript" src="__PUBLIC__/javascripts/admin/jquery-1.10.2.min.js"></script>
<script src="__PUBLIC__/yksui/js/zui.js"></script>
<!--日期-->
<script type="text/javascript" src="__PUBLIC__/yksui/lib/laydate/laydate.js"></script>
<!--常用-->
<script type="text/javascript" defer src="__PUBLIC__/yksui/js/admin.js"></script>

<script type="text/javascript" src="__PUBLIC__/javascripts/admin/layer/layer.js"></script>
<!------chosen css+js-->
<script type="text/javascript" src="__PUBLIC__/yksui/lib/chosen/chosen.min.js"></script>
<script type="application/javascript">
    /*$(function () {
        $("#sub").on('click', function () {
            formCheck();
            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            //alert($('#transForm').serialize());
            layer.load();
            $.ajax({
                url: "{:U('Transportplan/ajaxEditTrans')}",
                type: 'post',
                async: true, //default: true
                data: $('#transForm').serialize(),
                dataType: 'json', // default: Intelligent Guess (xml, json, script, or html)
                success: function (data, textStatus, jqXHR) {
                    if (data == '修改成功') {
                        parent.location.reload();
                        parent.layer.close(index); //执行关闭
                    }
                    layer.closeAll('loading');
                    layer.msg(data);
                    parent.location.reload();
                }
            })
        })
    })*/
    function statuscheck(opt) {
        alert(getCookie('curstatus'));
        if (opt < getCookie('curstatus') ) {
            alert("当前状态为修改失败!");
        }
    }
    function formCheck() {
        if ($('input[name="ori_tracking_num"]').val()=='' && $('input[name="certificate_code"]').val()=='') {
            alert("“提单号/快递单号”和“入仓号/柜号和封条号”两者只要其中一个为非空即可，但不可同时为空！");
            return false;
        }
    }
    $(function () {
        $('select.chosen-select').chosen({
            no_results_text: '没有找到',    // 当检索时没有找到匹配项时显示的提示文本
            disable_search_threshold: 2, // 10 个以下的选择项则不显示检索框
            search_contains: true         // 从任意位置开始检索
        });
    });

</script>
</body>
</html>